package awt;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Demo11 extends JFrame {
	MyPanle mp;

	public Demo11() {
		mp = new MyPanle();
		this.add(mp);
		this.setSize(400, 300);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setVisible(true);
	}

	public static void main(String[] args) {
		Demo11 demo11 = new Demo11();
	}

}

class MyPanle extends JPanel {
	@Override
	public void paint(Graphics g) {
		super.paint(g);
		System.out.println("paint被调用");
		g.setColor(Color.BLUE);
		g.fillOval(0, 0, 30, 30);
		g.drawLine(100, 100, 200, 200);
		g.setColor(Color.RED);
		g.draw3DRect(30, 40, 100, 200, false);
		Image im = Toolkit.getDefaultToolkit().getImage("images/pic1.jpg");
		g.drawImage(im, 90, 90, 180, 90, this);
		g.setColor(Color.GREEN);
		g.setFont(new Font("华文彩云", Font.BOLD, 50));

		g.drawString("TANK WAR", 100, 100);
	}
}